package cn.gson.crm.model.pojos;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

@Entity
public class Customer {
    private long customerId;
    private String customerName;
    private Long customerPhone;
    private String customerAddress;
    private String customerSource;
    private String customerType;
    private String customerDemand;
    private String customerRemark;
    private Date customerDate;
    private Date customerUpdate;
    private String customerDele;
    private String customerProvince;
    private String customerCity;
    private String customerArea;

    //负责人名称
    private Employee employee;
    private List<Sales> sales;

    @OneToMany(mappedBy = "customer")
    public List<Sales> getSales() {
        return sales;
    }

    public void setSales(List<Sales> sales) {
        this.sales = sales;
    }

    @ManyToOne
    @JoinColumn(name = "yg_id", referencedColumnName = "yg_id")
    public Employee getEmployee() {
        return employee;
    }

    public void setEmployee(Employee employee) {
        this.employee = employee;
    }

    @Id
    @Column(name = "customer_id")
    @GeneratedValue(generator  =  "seq",strategy  =  GenerationType.SEQUENCE)
    //定义一个序列生成器
    @SequenceGenerator(name  =  "seq",sequenceName  =  "crm",
            initialValue  =  1,allocationSize  =  1)
    public long getCustomerId() {
        return customerId;
    }

    public void setCustomerId(long customerId) {
        this.customerId = customerId;
    }

    @Basic
    @Column(name = "customer_name")
    public String getCustomerName() {
        return customerName;
    }

    public void setCustomerName(String customerName) {
        this.customerName = customerName;
    }

    @Basic
    @Column(name = "customer_phone")
    public Long getCustomerPhone() {
        return customerPhone;
    }

    public void setCustomerPhone(Long customerPhone) {
        this.customerPhone = customerPhone;
    }

    @Basic
    @Column(name = "customer_address")
    public String getCustomerAddress() {
        return customerAddress;
    }

    public void setCustomerAddress(String customerAddress) {
        this.customerAddress = customerAddress;
    }

    @Basic
    @Column(name = "customer_source")
    public String getCustomerSource() {
        return customerSource;
    }

    public void setCustomerSource(String customerSource) {
        this.customerSource = customerSource;
    }

    @Basic
    @Column(name = "customer_type")
    public String getCustomerType() {
        return customerType;
    }

    public void setCustomerType(String customerType) {
        this.customerType = customerType;
    }

    @Basic
    @Column(name = "customer_demand")
    public String getCustomerDemand() {
        return customerDemand;
    }

    public void setCustomerDemand(String customerDemand) {
        this.customerDemand = customerDemand;
    }

    @Basic
    @Column(name = "customer_remark")
    public String getCustomerRemark() {
        return customerRemark;
    }

    public void setCustomerRemark(String customerRemark) {
        this.customerRemark = customerRemark;
    }

    @Basic
    @Column(name = "customer_date")
    public Date getCustomerDate() {
        return customerDate;
    }

    public void setCustomerDate(Date customerDate) {
        this.customerDate = customerDate;
    }

    @Basic
    @Column(name = "customer_update")
    public Date getCustomerUpdate() {
        return customerUpdate;
    }

    public void setCustomerUpdate(Date customerUpdate) {
        this.customerUpdate = customerUpdate;
    }

    @Basic
    @Column(name = "customer_dele")
    public String getCustomerDele() {
        return customerDele;
    }

    public void setCustomerDele(String customerDele) {
        this.customerDele = customerDele;
    }

    @Basic
    @Column(name = "CUSTOMER_PROVINCE")
    public String getCustomerProvince() {
        return customerProvince;
    }

    public void setCustomerProvince(String customerProvince) {
        this.customerProvince = customerProvince;
    }

    @Basic
    @Column(name = "customer_city")
    public String getCustomerCity() {
        return customerCity;
    }

    public void setCustomerCity(String customerCity) {
        this.customerCity = customerCity;
    }

    @Basic
    @Column(name = "customer_area")
    public String getCustomerArea() {
        return customerArea;
    }

    public void setCustomerArea(String customerArea) {
        this.customerArea = customerArea;
    }

    @Override
    public String toString() {
        return "Customer{" +
                "customerId=" + customerId +
                ", customerName='" + customerName + '\'' +
                ", customerPhone=" + customerPhone +
                ", customerAddress='" + customerAddress + '\'' +
                ", customerSource='" + customerSource + '\'' +
                ", customerType='" + customerType + '\'' +
                ", customerDemand='" + customerDemand + '\'' +
                ", customerRemark='" + customerRemark + '\'' +
                ", customerDate=" + customerDate +
                ", customerUpdate=" + customerUpdate +
                ", customerDele='" + customerDele + '\'' +
                ", customerProvince='" + customerProvince + '\'' +
                ", customerCity='" + customerCity + '\'' +
                ", customerArea='" + customerArea + '\'' +
                '}';
    }
}
